﻿package mortal.game.view.copy.copyFailWin
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.palyer.data.*;
    import mortal.mvc.core.*;

    public class CopyFailModuleRender extends GSprite
    {
        public var moduleLevel:int;
        private var _currentType:int;
        private var _btn:GLoadingButton;
        public static const strength:int = 1;
        public static const pet:int = 2;
        public static const mounth:int = 3;
        public static const wizard:int = 4;
        public static const weapon:int = 5;
        public static const fashion:int = 6;
        public static const wing:int = 7;

        public function CopyFailModuleRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildren();
            this._btn = UIFactory.gLoadingButton("", 0, 0, 91, 75, this);
            this._btn.configEventListener(MouseEvent.CLICK, this.openWin);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._btn.dispose(param1);
            this._btn = null;
            return;
        }// end function

        public function setModuleType(param1:int) : void
        {
            var _loc_2:String = null;
            this._currentType = param1;
            switch(this._currentType)
            {
                case strength:
                {
                    _loc_2 = ResFileConst.CopyFailForginBtn;
                    break;
                }
                case pet:
                {
                    _loc_2 = ResFileConst.CopyFailPetBtn;
                    break;
                }
                case mounth:
                {
                    _loc_2 = ResFileConst.CopyFailMountBtn;
                    break;
                }
                case weapon:
                {
                    _loc_2 = ResFileConst.CopyFailWeaponBtn;
                    break;
                }
                case fashion:
                {
                    _loc_2 = ResFileConst.CopyFailFasionBtn;
                    break;
                }
                case wing:
                {
                    _loc_2 = ResFileConst.CopyFailWingBtn;
                    break;
                }
                default:
                {
                    break;
                }
            }
            this._btn.styleName = _loc_2;
            return;
        }// end function

        private function openWin(event:MouseEvent) : void
        {
            switch(this._currentType)
            {
                case strength:
                {
                    GameManager.instance.popupModuleType(ModuleType.Build);
                    break;
                }
                case pet:
                {
                    GameManager.instance.popupModuleType(ModuleType.Pets);
                    break;
                }
                case mounth:
                {
                    GameManager.instance.popupModuleType(ModuleType.Mounts);
                    break;
                }
                case weapon:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PlayerModuleShowIndexByType, PlayerConst.TabType_Artifact));
                    break;
                }
                case fashion:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PlayerModuleShowIndexByType, PlayerConst.TabType_Clothes));
                    break;
                }
                case wing:
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PlayerModuleShowIndexByType, PlayerConst.TabType_Wing));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function set clickEabled(param1:Boolean) : void
        {
            this._btn.enabled = param1;
            return;
        }// end function

    }
}
